package com.xinke.edu.mypetadoption.fragment.Home.adpter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter4.BaseQuickAdapter;
import com.chad.library.adapter4.viewholder.QuickViewHolder;
import com.xinke.edu.mypetadoption.R;
import com.xinke.edu.mypetadoption.entity.ProductCategory;

public class ProductTypeAdpter extends BaseQuickAdapter<ProductCategory, QuickViewHolder> {

    @Override
    protected void onBindViewHolder(@NonNull QuickViewHolder quickViewHolder, int i, @Nullable ProductCategory productCategory) {
        LinearLayout layout = quickViewHolder.getView(R.id.type_layout);
        layout.setSelected(productCategory.isIsselect());
        quickViewHolder.setText(R.id.type, productCategory.getName());
    }

    @NonNull
    @Override
    protected QuickViewHolder onCreateViewHolder(@NonNull Context context, @NonNull ViewGroup viewGroup, int i) {
        return new QuickViewHolder(R.layout.item_type,viewGroup);
    }
}
